<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * 后台管理主页面
 * @author 		jaypha
 * @qq			168007694
 * @email		psufool@163.com
 * @home page	www.psufool.cn
 */
class Main extends Admin_Controller{
	
	function __construct(){
		parent::__construct();
		$this->load->model('JayphaDB');
		if(is_null($this->adminCurrentTemplate) or empty($this->adminCurrentTemplate)){
			$this->adminCurrentTemplate = 'default';
		}
		$this->dbTablePrefix = $this->config->item('db_table_prefix');
	}
	
	function index(){
		if(!$this->noLoginErr()) return false;
		$data['adminCurrentTemplate'] = $this->adminCurrentTemplate;
		$data['perm'] = 'main';
		$data['adminPermission'] = $this->JayphaDB->getAdminPermission($this->session->userdata('adminUserId'));
		$data['pageTag'] = '管理首页';
		$data['currentSite'] = '';
		$data['serverName'] = $this->input->server('SERVER_NAME');
		$data['serverIP'] = $this->input->server('SERVER_ADDR');
		$data['serverPort'] = $this->input->server('SERVER_PORT');
		$data['serverTime'] = date('Y-m-d H:m:s',now());
		$tvName = 'admin_login_log';
		$where = array('adminId'=>$this->session->userdata('adminUserId'));
		$order = 'id desc';
		$data['loginCount'] = $this->JayphaDB->getDBCount($this->dbTablePrefix.$tvName,$where);
		$data['lastLogin'] = $this->JayphaDB->getDB(0,1,'',$this->dbTablePrefix.$tvName,$where,$order,true);
		$this->load->view("admin/$this->adminCurrentTemplate/main",$data);
	}
}

/* End of file main.php */
/* Location: ./application/controllers/admin/main.php */